package com.jishuo.nontax.web;

import com.jishuo.base.annotation.UserAuthority;
import com.jishuo.base.bean.BaseResult;
import com.jishuo.base.bean.GridResult;
import com.jishuo.base.bean.Pagination;
import com.jishuo.base.bean.vo.RoleVO;
import com.jishuo.base.util.StringObject;
import com.jishuo.nontax.bean.vo.PayScaleBillVO;
import com.jishuo.nontax.bean.vo.PaySpecialVO;
import com.jishuo.nontax.bfc.service.PayScaleBillService;
import com.jishuo.nontax.bfc.service.SpecialService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @auther dinggaofei
 * @Date 2023/3/2 17:04
 */
@Slf4j
@Controller
@RequestMapping(value = "/bill/scalebill", name = "交管二八分成单据")
@UserAuthority(menu = {"bill/scalebill", "sys/basedata/basedata"})
public class ScaleBillController {
    @Resource
    private PayScaleBillService payScaleBillService;

    private String prefix = "bill/";

    @ResponseBody
    @RequestMapping(value = "listPayScale", name = "交管二八分成列表")
    public GridResult<PayScaleBillVO> listSpecial(PayScaleBillVO payScaleBillVO, Pagination pagination) {
        return new GridResult<>(payScaleBillService.listPayScale(payScaleBillVO, pagination));
    }

    @RequestMapping(value = {"scalebill", "scalebill/{page}"}, name = "交管二八分成首页")
    public String index(@PathVariable(required = false) String page) {
        return prefix + ((page == null) ? "scalebill" : page);
    }


    @ResponseBody
    @RequestMapping(value = "saveIllAgeScale", name = "修改交管二八分成银行信息")
    public BaseResult saveIllAgeScale(PayScaleBillVO payScaleBillVO) {
        return payScaleBillService.saveIllAgeScale(payScaleBillVO);
    }

    @ResponseBody
    @RequestMapping(value = "getPayScale", name = "二八分成详情")
    public BaseResult getPayScale(Long payscalebillid) {
        PayScaleBillVO payScaleBillVO = payScaleBillService.getPayScale(payscalebillid);
        return new BaseResult(payScaleBillVO);
    }

    @ResponseBody
    @RequestMapping(value = "sendPayScale", name = "发送交管二八分成信息")
    public BaseResult sendPayScale(@RequestParam List<String> billids, String userpwd, String usercode) {
        return payScaleBillService.sendPayScale(billids, userpwd, usercode);
    }

    @ResponseBody
    @RequestMapping(value = "cleanPayScale", name = "冲销交管二八分成信息")
    public BaseResult cleanPayScale(@RequestParam List<String> billids, String userpwd, String usercode) {
        return payScaleBillService.cleanPayScale(billids, userpwd, usercode);
    }
    @ResponseBody
    @RequestMapping(value = "scaleBillExport",name = "导出交管二八分成信息")
    public void  scaleBillExport(@RequestParam List<String> billids , HttpServletResponse response){
         payScaleBillService.scaleBillExport(billids,response);
    }
}
